//Our includes
#include "TestA.h"
//#include "TestB.h"

//Debug
#include <iostream>

//Qt includes
#include <QVariant>
#include <QTextStream>

pl_DEFINE_CLASS(TestA)

/*
cw_BEGIN_CLASS(TestA)
	cw_PROPERTY(TestLong)
	cw_PROPERTY(TestDouble)
	cw_PROPERTY(TestInt)
	cw_PROPERTY(TestString)
	cw_PROPERTY(TestPointer)
cw_END_CLASS(TestA)
*/

//Statics for book keeping
/*
cwFactoryElement TestA::_FactoryElement("TestA", &cwFactoryElement::ObjectFactoryFunction<TestA>);
const char* TestA::_Properties [ ] = {
	"TestLong",
	"TestDouble",
	"TestInt",
	"TestString",
	"TestPointer"
};

const char* TestA::_GetClassName() { return _FactoryElement.GetClassName(); }
int TestA::_PropertyCount() { return sizeof(_Properties) / sizeof(const char*); }
const char* TestA::_GetProperty(int index)  { return _Properties[index]; }
*/

////////////////////////////////////////////////// Public ///////////////////////////////////////////////////////////

//Constructor
TestA::TestA() {

	CreateObject();
	
	TestLong.Setup("TestLong", this);
	TestDouble.Setup("TestDouble", this);
	TestInt.Setup("TestInt", this);
	TestString.Setup("TestString", this);
	TestPointer.Setup("TestPointer", this);
	
	TestDouble = 5.0;
	TestDouble = 10.0;
	TestDouble = 11.0;
	TestInt = 4;

	QString str("My id: ");
	QTextStream(&str) << Id();
        TestString = str.toStdString();
	
	//PointerList.LoadFromDB();
	
	//double test = TestDouble;
}

//Destructor
TestA::~TestA() {
	DeleteObject();
}

void TestA::SetSubTest(TestA* trip) {
	TestPointer = trip;
}

	
//Sets the TestDouble
void TestA::SetTestDouble(double value) {
	TestDouble = value;
}

//Gets the TestDouble
double TestA::GetTestDouble() {
	return TestDouble;
}

const std::string& TestA::GetTestString() {
	return TestString;
}

void TestA::SetTestString(const plString& str) {
	TestString = str;
}

void TestA::SetTestPointer(TestA* value) { TestPointer = value; }
TestA* TestA::GetTestPointer() { return TestPointer; }
